package cn.tedu.demo;

import java.util.HashSet;
import java.util.Random;
import java.util.Set;

/**
 * @author CCFu
 * @version 1.0
 * @date 2021/11/29 8:48
 */
public class RadomArray {
    public static void main(String[] args) {
        Set<String> s = new HashSet<>();
        String[] a1 = {"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
        System.out.println(a1[5]);
        while (true){
            int r = new Random().nextInt(a1.length);
            s.add(a1[r]);
            if (s.size() >= 5) {
                break;
            }
        }
        System.out.println(s);
        Object[] o = s.toArray();
        for (int i = 0; i < o.length; i++) {
            System.out.println(o[i]);
        }
    }
}
